﻿using System;

namespace FlowersStore
{
	public partial class SiteMaster : System.Web.UI.MasterPage
	{
		protected void Page_Load(object sender, EventArgs e)
		{
            FillCartItems();
		}

		public void FillCartItems()
		{
			int productsCount = 0;
			decimal totalPrice = 0;
			if (Session["cart"] != null)
			{
				UserCart cart = (UserCart)Session["cart"];
				productsCount = cart.GetProductsCount();
				totalPrice = cart.ComputeTotalPrice();
			}						
			lblProductsInCart.Text = productsCount.ToString();			
			lblTotalPrice.Text = string.Format("{0:n0}", totalPrice);
		}
	}
}
